

import gui.ontoTree.OntoTree;
import java.awt.*;
import java.net.URI;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import org.semanticweb.owl.apibinding.OWLManager;
import org.semanticweb.owl.model.OWLOntology;
import org.semanticweb.owl.model.OWLOntologyCreationException;
import org.semanticweb.owl.model.OWLOntologyManager;

class TreeExample
		extends 	JFrame
 {
	// Instance attributes used in this example
	private	JPanel		topPanel;
	private	JTree		tree;
	private	JScrollPane scrollPane;

	// Constructor of main frame
	public TreeExample()
	{
		// Set the frame characteristics
		setTitle( "Simple Tree Application" );
		setSize( 300, 100 );
		setBackground( Color.gray );

		// Create a panel to hold all other components
		topPanel = new JPanel();
		topPanel.setLayout( new BorderLayout() );
		getContentPane().add( topPanel );

		// Create a new tree control
                 DefaultMutableTreeNode top =
                    new DefaultMutableTreeNode("oi");
                 createNodes(top);
                tree = new JTree(top);
		//tree = new JTree();

		// Add the listbox to a scrolling pane
		scrollPane = new JScrollPane();
		scrollPane.getViewport().add( tree );
		topPanel.add( scrollPane, BorderLayout.CENTER );
	}
        private void createNodes(DefaultMutableTreeNode top) {
        DefaultMutableTreeNode category = null;
        DefaultMutableTreeNode book = null;

        category = new DefaultMutableTreeNode("Books for Java Programmers");
        top.add(category);

        //original Tutorial
        book = new DefaultMutableTreeNode("The Java Tutorial: A Short Course on the Basics");
        category.add(book);

        //Tutorial Continued
        book = new DefaultMutableTreeNode("The Java Tutorial Continued: The Rest of the JDK");
        category.add(book);

        //JFC Swing Tutorial
        book = new DefaultMutableTreeNode("The JFC Swing Tutorial: A Guide to Constructing GUIs");
        category.add(book);

    }

	// Main entry point for this example
	public static void main( String args[] ) throws OWLOntologyCreationException
        {
		// Create an instance of the test application
		TreeExample mainFrame	= new TreeExample();
		mainFrame.setVisible( true );
                OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
                URI uriE = URI.create("file:///C:/Documents%20and%20Settings/livia/Meus%20documentos/workspace/CID/ontologies/Ebay.owl");
        	OWLOntology ebay = manager.loadOntologyFromPhysicalURI(uriE);
                OntoTree t = new OntoTree(ebay, mainFrame.tree);
	}
}